package com.ewing.busi.carry.helper;

/**
 * 
 * @author chenxuegui@163.com
 * @createDate 2016年9月4日
 *
 */
public class WebCarryHelper {

  public static double calcCarryPrice(Integer firstAmount, Float firstFee, Integer secAmount,
      Float secFee, Integer count) {
    if (null == count) {
      return 0d;
    }

    double result = 0d;
    if (count <= firstAmount) {
      result = firstFee;
    } else {
      result += firstFee;
      result += (count / secAmount) * secFee;
      if (count % secAmount > 0) {
        result += secFee;
      }
    }

    return result;
  }

}
